package com.dataart.productshop.service.impl;

import com.dataart.productshop.dao.KathedraDao;
import com.dataart.productshop.model.boiko.informationsystem.Kathedra;
import com.dataart.productshop.service.KathedraManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class KathedraManagerImpl extends BaseManagerImpl<Kathedra> implements KathedraManager{

    @Autowired
    public void setKathedraDao(KathedraDao kathedraDao){
        this.kathedraDao = kathedraDao;
        setBaseDao(kathedraDao);
    }

    @Override
    public void removeByName(String name){
        kathedraDao.removeByName(name);
    }

    @Override
    public List<Kathedra> getAll(){
        List<Kathedra> all = super.getAll();
        for (Kathedra kathedra : all) {
            kathedra.getLecturers().size();
            kathedra.getStudents().size();
        }
        return all;
    }
}
